﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AgilePlannerDT.Data.Impl
{

    public class LiveUpdateDataObject:LiveUpdate
    {
        public static int NAME_TEXTBOX = 0;
        public static int DESCRIPTION_TEXTBOX = 1;
        private string text;
        int field;
        long cardID;
        #region LiveUpdate Members

        public LiveUpdateDataObject() : this("", 0, 0) { }
        public LiveUpdateDataObject(string inputText,int item,long id)
        {
            this.text = inputText;
            this.field = item;
            this.cardID = id;
        }

        public string Text
        {
            get { return this.text; }
        }

        public int Field
        {
            get { return this.field; }
        }

        public long ID
        {
            get { return this.cardID; }
        }

        #endregion

        #region IXmlSerializable Members

        public System.Xml.Schema.XmlSchema GetSchema()
        {
            throw new NotImplementedException();
        }

        public void ReadXml(System.Xml.XmlReader reader)
        {
            this.text = reader.GetAttribute("text");
            this.field = Convert.ToInt32(reader.GetAttribute("field"));
            this.cardID = (long)Convert.ToDouble(reader.GetAttribute("id"));
        }

        public void WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteStartElement("LiveUpdate");
            writer.WriteAttributeString("text", Text);
            writer.WriteAttributeString("field", Field.ToString());
            writer.WriteAttributeString("id", ID.ToString());
            writer.WriteEndElement();
        }

        #endregion
    }
}
